﻿#if WINDOWS_UWP
#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>$CreationDate$</CreationDate>
</File>
*/
#endregion

namespace Outcoder.Services.Implementation
{
	public partial class LockScreenService
	{
		void InitializeWhenReady()
		{
			InitializeCore();
		}

		void InitializeCore()
		{
			var settingsService = Dependency.Resolve<ISettingsService, SettingsService>();

			if (settingsService.ContainsSetting(promptedKey))
			{
				UserPrompted = true;
			}

			RunningUnderLockScreenEnabled = settingsService.GetSetting(runningEnabledKey, false);

			//var frame = (PhoneApplicationFrame)Application.Current.RootVisual;
			//frame.Obscured += HandleFrameObscured;
			//frame.Unobscured += HandleFrameUnobscured;
		}

		//void HandleFrameObscured(object o, ObscuredEventArgs args)
		//{
		//	RunningUnderLockScreen = args.IsLocked;
		//
		//	IMessenger messenger;
		//	if (Dependency.TryResolve<IMessenger>(out messenger))
		//	{
		//		messenger.Publish(new LockScreenEvent(LockScreenEvent.LockScreenState.Engaged));
		//	}
		//}

		void EnableRunningUnderLockScreen()
		{
			//PhoneApplicationService.Current.ApplicationIdleDetectionMode
			//												= IdleDetectionMode.Disabled;
		}
	}
}
#endif